package com.cbn.ibcp.web.jishiting.operator.convert;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.cbn.ibcp.common.utils.bean.BeanUtils;
import com.cbn.ibcp.jishiting.media.bo.EpisodeResourceStreamBO;
import com.cbn.ibcp.web.jishiting.operator.vo.EpisodeResourceStreamVO;

public class EpisodeResourceStreamBOConvert {

    public static EpisodeResourceStreamVO convertToEpisodeResourceStreamVO(EpisodeResourceStreamBO episodeResourceStreamBO) {
        if (episodeResourceStreamBO == null) {
            return null;
        }
        EpisodeResourceStreamVO episodeResourceStreamVO = new EpisodeResourceStreamVO();
        BeanUtils.copyBeanProp(episodeResourceStreamVO, episodeResourceStreamBO);
        episodeResourceStreamVO.setEpisodeId(StrUtil.toStringOrNull(episodeResourceStreamBO.getEpisodeId()));
        episodeResourceStreamVO.setEpisodeName(episodeResourceStreamBO.getEpisodeName());
        episodeResourceStreamVO.setAlbumId(StrUtil.toStringOrNull(episodeResourceStreamBO.getAlbumId()));
        episodeResourceStreamVO.setAlbumName(StrUtil.toStringOrNull(episodeResourceStreamBO.getAlbumName()));
        episodeResourceStreamVO.setSourceId(StrUtil.toStringOrNull(episodeResourceStreamBO.getSourceId()));
        episodeResourceStreamVO.setCreateTime(DateUtil.format(episodeResourceStreamBO.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
        episodeResourceStreamVO.setUpdateTime(DateUtil.format(episodeResourceStreamBO.getUpdateTime(), DatePattern.NORM_DATETIME_PATTERN));
        return episodeResourceStreamVO;
    }
}
